<%--
    Document   : loancollection
    Created on : Apr 6, 2011, 3:37:32 PM
    Author     : Dine
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<html>
    <head>
        <sj:head jqueryui="true" jquerytheme="south-street" compressed="false"/>
        <jsp:include page="WEB-INF/fragments/globalHead.html"/>
        <title>Cashmate <s:property value="#session.branch.branchname"/> - Loan Verification</title>
        <style type="text/css">
            #verinfo label{
                margin-right:7em;
            }

            #verinfo input{
                margin-right:5em;
            }
        </style> <!--main.jsp css-->
        <script type="text/javascript">
            $(document).ready(function(){
                $("#subMenuLoanVerification").addClass("ui-state-highlight");
                
                $('#lastname').keypress(function(e){
                    if ( e.which == 13 ) {
                        e.preventDefault();
                    }
                    var code= (e.keyCode ? e.keyCode : e.which);
                                    
                    if(code==13){
                        e = e||window.event;
                        e.stopPropagation();
                        e.preventDefault();
                        
                        document.bortable.submit();
                    }
                });
            });
            
            function refreshTheGrid(e){
                //                alert(e);
                alert("woi");
                $.ajax({
                    type:'POST',
                    url:"Cashmate/grid-loans",
                    data:"borrowerid="+e,
                    success:function(msg,textStatus,xhr){
                        //                        $("#loanGrid").trigger("reloadGrid");
                        alert("success");
        
                    },error:
                        function(xhr, textStatus, errorThrown){
                        //                                document.getElementById("firstname").style.color = "red";
                        //                                document.getElementById("middlename").style.color = "red";
                        //                                document.getElementById("lastname").style.color = "red";
                        //                                $('#streetaddress').val("");
                        //                                $('#barangay').val("");
                        //                                $('#cityormunicipality').val("");
                        //                                $('#province').val("");
                        alert("error");
                    }
                });
            }
        </script> <!--main.jsp script-->
    </head>
    <body>

        <c:if test="${sessionScope.auth == null || sessionScope.auth == false}">
            <%--<jsp:forward page="index.jsp?auth=none"/>--%>
        </c:if>
        <s:div id="bodyContainer">
            <s:div id="logoContainer" cssClass="ui-widget-content ui-corner-all">
                <s:include value="WEB-INF/fragments/banner.jsp">
                    <s:param name="branch" value="#session.branch.branchname" />
                </s:include>
            </s:div>
            <jsp:include page="WEB-INF/fragments/top.jsp"/>
            <jsp:include page="WEB-INF/fragments/mainMenu.jsp?menu=Loan"/>
            <jsp:include page="WEB-INF/fragments/left.jsp?type=loan&innerType=loanverification"/>

            <s:div id="contentContainer" cssClass="ui-widget-content ui-corner-all">
                <h1 id="contentHeader" class="ui-state-default ui-corner-all"></h1>
                <s:div id="theContent">
                    <%--<jsp:include page="WEB-INF/fragments/admin/borrower.jsp"/>--%>
                    <s:form id="bortable" action="get-history" theme="simple">
                        <table cellspacing="0" border="0" width="100%">
                            <tr>
                                <td><s:label cssStyle="font-size: 10px !important">Borrower ID No.:</s:label></td>
                                <td><s:textfield cssStyle="font-size: 11px; width: 100px;" cssClass="entry" label="Borrower Code" key="borrower.borrowerid" name="bcode" id="borid" value="%{#request['borrowerinfo'].borrowercode}"/></td>
                                <td><s:label>Borrower Name:</s:label></td>
                                <s:if test="%{#request['borrowerinfo'] != null}">
                                    <td>
                                        <div class="inputContainer"><s:textfield cssStyle="font-size: 11px; width: 160px" label="First Name" key="bor.firstname" value="%{#request['borrowerinfo'].firstname}" name="firstname" id="firstname" cssClass="validate[required] text-input" /></div>
                                    </td>    
                                    <td>
                                        <div class="inputContainer"><s:textfield cssStyle="font-size: 11px; width: 160px" label="Middle Name" key="bor.middlename" value="%{#request['borrowerinfo'].middlename}" name="middlename" id="middlename" title="Please enter your username (at least 3 characters)" cssClass="validate[required] text-input" /></div>
                                    </td>
                                    <td>
                                        <div class="inputContainer"><s:textfield cssStyle="font-size: 11px; width: 160px" label="Last Name" key="bor.lastname" value="%{#request['borrowerinfo'].lastname}" name="lastname" id="lastname" title="Please enter your username (at least 3 characters)" cssClass="entry" /></div>
                                    </td>
                                </s:if>
                                <s:else>
                                    <td>
                                        <div class="inputContainer"><s:textfield cssStyle="font-size: 11px; width: 160px" label="First Name" key="bor.firstname" value="First Name" name="firstname" id="firstname" cssClass="validate[required] text-input" /></div>
                                    </td>    
                                    <td>
                                        <div class="inputContainer"><s:textfield cssStyle="font-size: 11px; width: 160px" label="Middle Name" key="bor.middlename" value="Middle Name" name="middlename" id="middlename" title="Please enter your username (at least 3 characters)" cssClass="validate[required] text-input" /></div>
                                    </td>    
                                    <td>
                                        <div class="inputContainer"><s:textfield cssStyle="font-size: 11px; width: 160px" label="Last Name" key="bor.lastname" value="Last Name" name="lastname" id="lastname" title="Please enter your username (at least 3 characters)" cssClass="entry" /></div>
                                    </td>
                                </s:else>
                                <td>
                                    <sj:submit id="woah" button="true" cssClass="ui-state-default" cssStyle="font-size: 12px" value="Enter"/>
                                </td>
                            </tr>
                        </table>
                    </s:form>
                    <%--<jsp:include page="admin/loan.jsp" />--%>
                    <sj:tabbedpanel id="mytabs" animate="true" collapsible="true" useSelectedTabCookie="true" cssStyle="font-size: 11px">
                        <sj:tab id="tab1" cssClass="tabs" target="history" label="History" accesskey=""/>
                        <sj:tab id="tab3" cssClass="tabs" target="loans" label="Loans"/>
                        <sj:tab id="tab4" cssClass="tabs" target="payments" label="Payments"/>

                        <div id="history">
                            <s:form theme="simple" id="prevtable">
                                <table>
                                    <tr><td colspan="2"><h3>Previous Loan</h3></td></tr>
                                    <tr style="display: none">
                                        <td><s:label>Loan ID<strong></strong></s:label></td>
                                        <td><s:textfield id="prevloanid" readonly="true" cssStyle="font-size: 11px; width: 100px" name="previousloanid" value="%{#request['latestloan'].loanid}" /></td>
                                    </tr>
                                    <tr>
                                        <td><s:label>Account No.<strong></strong></s:label></td>
                                        <td><s:textfield name="prevacctno" id="prevacctno" readonly="true" cssStyle="font-size: 11px; width: 100px" value="%{#request['latestloan'].account}" /></td>
                                    </tr>
                                    <tr>
                                        <td><s:label>PN Amount<strong></strong></s:label></td>
                                        <td><s:textfield name="prevamt" id="prevamt" readonly="true" cssStyle="font-size: 11px; width: 100px" value="%{#request['latestloan'].loanamount}" /></td>
                                    </tr>
                                    <tr>
                                        <td><s:label>Loan Class<strong></strong></s:label></td>
                                        <td><s:textfield name="prevclass" id="prevclass" readonly="true" cssStyle="font-size: 11px; width: 100px" value="%{#request['latestloan'].loanverification.products.productname}" /></td>
                                    </tr>
                                    <tr>
                                        <td><s:label>Loan Type<strong></strong></s:label></td>
                                        <%--<s:if test="%{request[latestloanver] =='renew'}">--%>
                                        <td><s:textfield name="prevtype" id="prevtype" cssStyle="font-size: 11px; width: 100px" readonly="true" value="%{#request['latestloan'].loanverification.loantype}" /></td>
                                        <%--</s:if>
                                        <s:else>
                                            <td><s:textfield name="prevtype" id="prevtype" cssStyle="font-size: 11px; width: 100px" readonly="true" value="New" /></td>
                                        </s:else>--%>
                                    </tr>
                                    <tr>
                                        <td><s:label>Loan Term<strong></strong></s:label></td>
                                        <td><s:textfield name="prevterm" id="prevterm" readonly="true" cssStyle="font-size: 11px; width: 100px" value="%{#request['latestloan'].term}" /></td>
                                    </tr>
                                    <tr>
                                        <td><s:label>Loan Balance<strong></strong></s:label></td>
                                        <td><s:textfield name="prevbal" id="prevbal" readonly="true" cssStyle="font-size: 11px; width: 100px" value="%{#request['latestloan'].balance}" /></td>
                                    </tr>
                                    <tr>
                                        <td><s:label>Date of Release<strong></strong></s:label></td>
                                        <td><s:textfield name="prevdate" id="prevdate" readonly="true" cssStyle="font-size: 11px; width: 100px" value="%{#request['latestloan'].releasedate}" /></td>
                                    </tr>
                                    <tr>
                                        <td><s:label>Loan No.<strong></strong></s:label></td>
                                        <td><s:textfield name="prevloanno" id="prevloanno" readonly="true" cssStyle="font-size: 11px; width: 100px" value="%{#request['latestloan'].loanno}" /></td>
                                    </tr>
                                    <tr>
                                        <td><s:label>Days Left<strong></strong></s:label></td>
                                        <td><s:textfield name="prevleft" id="prevleft" readonly="true" cssStyle="font-size: 11px; width: 100px" value="%{#request['latestloan'].releasedate}" /></td>
                                    </tr>
                                </table>
                            </s:form>
                        </div>
                        <div id="loans">
                            <jsp:include page="WEB-INF/fragments/admin/loan.jsp"/>
                        </div>
                        <div id="payments">
                            <jsp:include page="WEB-INF/fragments/headofficepayment.jsp"/>
                        </div>
                    </sj:tabbedpanel>
                </s:div>
            </s:div>
            <jsp:include page="WEB-INF/fragments/bottom.jsp"/>
        </s:div>
    </body>
</html>
